From e747ec3ea02dd01e9ffa9e398e24e6939a5b738c Mon Sep 17 00:00:00 2001
From: Sebastien Castiel <sebastien@castiel.me>
Date: Wed, 6 Dec 2023 17:47:41 -0500
Subject: Tabs

---
 src/app/groups/[groupId]/group-tabs.tsx | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/app/groups/[groupId]/group-tabs.tsx

(limited to 'src/app/groups/[groupId]/group-tabs.tsx')

diff --git a/src/app/groups/[groupId]/group-tabs.tsx b/src/app/groups/[groupId]/group-tabs.tsx
new file mode 100644
index 0000000..e5c48c2
--- /dev/null
+++ b/src/app/groups/[groupId]/group-tabs.tsx
@@ -0,0 +1,30 @@
+'use client'
+import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
+import { usePathname, useRouter } from 'next/navigation'
+
+type Props = {
+  groupId: string
+}
+
+export function GroupTabs({ groupId }: Props) {
+  const pathname = usePathname()
+  const value =
+    pathname.replace(/\/groups\/[^\/]+\/([^/]+).*/, '$1') || 'expenses'
+  const router = useRouter()
+
+  return (
+    <Tabs
+      value={value}
+      className="mb-4"
+      onValueChange={(value) => {
+        router.push(`/groups/${groupId}/${value}`)
+      }}
+    >
+      <TabsList>
+        <TabsTrigger value="expenses">Expenses</TabsTrigger>
+        <TabsTrigger value="balances">Balances</TabsTrigger>
+        <TabsTrigger value="edit">Settings</TabsTrigger>
+      </TabsList>
+    </Tabs>
+  )
+}
-- 
cgit v1.3

